close all
global nx alx aly dy nts dt
%%
xx=linspace(0,alx,nx);
yy=0:dy:aly+dy; 
tt=0:dt:nts*dt;
w1=zeros(nts+1,nx,20);w2=zeros(nts+1,nx,20);
load([saldir,'initial'])
sv=fft(wi,[],2);w1(1,:,:)=sv(:,2:21);
sv=fft(phii,[],2);w2(1,:,:)=sv(:,2:21);
for nt=1:nts
    load([saldir,'dat',sprintf('%4.4d',nt)])
    sv=fft(wi,[],2);w1(nt+1,:,:)=sv(:,2:21);
    sv=fft(phii,[],2);w2(nt+1,:,:)=sv(:,2:21);
    for m=1:20
        w1(nt+1,:,m)=smooth(w1(nt+1,:,m));
    end
end
for m=1:7
    pcolor(xx,tt,squeeze(angle(w1(:,:,m))));
    colorbar('FontSize',15); caxis([-pi,pi])
    shading interp;colormap hot
    set(gca,'YTick',0:10:50);ylabel('t','FontSize',15)
    set(gca,'XTick',0:2:14);xlabel('x','FontSize',15)
    set(gca,'FontSize',15)
    drawnow
    print(gcf,'-dpng',[saldir1,sprintf('wp%d',m)]);
    close
end
for m=1:7
    pcolor(xx,tt,squeeze(angle(w2(:,:,m))));
    colorbar; shading interp;
    title('$$\Theta$$','Interpreter','latex')
    ylabel('t')
    xlabel('x')
    drawnow
    print(gcf,'-dpng',[saldir1,sprintf('pp%d',m)]);
    close
end
fr=2*pi/(nts*dt);ff=-(0:fr:90*fr);w3=fft(w2,[],1);
for m=1:7
    pcolor(xx,ff,squeeze(abs([w3(1,:,m);w3(end:-1:end-89,:,m)])));
    colorbar; shading interp;
    ylabel('$\Omega$','interpreter','latex')
    xlabel('x')
    drawnow
    print(gcf,'-dpng',[saldir1,sprintf('frp%d',m)]);
    close
end